package com.cloudfun.campusshare.common.model.dto;

import com.cloudfun.campusshare.common.constant.BaseConstant;
import com.cloudfun.campusshare.common.constant.CouponType;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

/**
 * Created by Huqin on 2020/5/29
 */
@Data
@ApiModel("用户优惠券创建DTO")
public class UserCouponCreateDTO {

    @ApiModelProperty("客户手机号")
    @NotEmpty(message = "手机号不能为空")
    @Pattern(regexp = BaseConstant.PHONE_REGEX_PATTERN, message = "手机号输入有误")
    private String userPhone;

    @ApiModelProperty("洗衣点id")
    @NotEmpty(message = "洗衣点不能为空")
    private String washPointId;

    @ApiModelProperty("优惠券类型")
    @NotNull(message = "优惠券类型不能为空")
    private CouponType couponType;

    @ApiModelProperty("金额")
    @NotNull(message = "金额不能为空")
    private String amount;

    @ApiModelProperty("数量")
    @NotNull(message = "数量不能为空")
    @Range(min = 1, max = 10, message = "数量输入有误")
    private Integer count;

    @ApiModelProperty("有效期")
    @NotNull(message = "有效期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime expirationDate;

    private String couponId;
    private String issuerId;
    private String issuerName;
    private String merchantId;
    private String promotionId;
}
